package com.currency.mall.adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.currency.mall.R;
import com.currency.mall.entity.OrderInfo;
import com.currency.mall.entity.WalletBean;
import com.currency.mall.util.TimeUtil;
import com.currency.mall.util.Util;

import java.util.List;

/**
 * Created by Administrator on 2018/12/5.
 */

public class OrderEntrustAdapter extends BaseQuickAdapter<OrderInfo, BaseViewHolder> {

    public OrderEntrustAdapter(@Nullable List<OrderInfo> data, Context context) {
        super(R.layout.item_order_entrust, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderInfo orderInfo) {
        helper.setText(R.id.tv_bid_name,orderInfo.getSharesName()+" ("+orderInfo.getSharesCode()+" )");
        helper.setText(R.id.tv_entrust_time,orderInfo.getBeginTime().substring(0,10));
        if("DAY".equals(orderInfo.getRoyaltyType())){
            helper.setText(R.id.tv_option_cycle,orderInfo.getRoyaltyVal()+"天");
        }else  if("WEEK".equals(orderInfo.getRoyaltyType())){
            helper.setText(R.id.tv_option_cycle,orderInfo.getRoyaltyVal()+"周");
        }else  if("MONTH".equals(orderInfo.getRoyaltyType())){
            helper.setText(R.id.tv_option_cycle,orderInfo.getRoyaltyVal()+"月");
        }
        helper.setText(R.id.tv_nominal_principal, Util.formatTosepara(Double.parseDouble(orderInfo.getNameSum())));
        helper.setText(R.id.tv_royalty,Util.formatTosepara(Double.parseDouble(orderInfo.getRightSum())));

    }

}
